//
//  CustomalertViewController.m
//  Sewage
//
//  Created by 优聚泰元 on 2017/6/6.
//  Copyright © 2017年 宗庆猛. All rights reserved.
//

#import "CustomalertViewController.h"

@interface CustomalertViewController ()

@end

@implementation CustomalertViewController
+ (instancetype)alertControllerWithTitle:(NSString *)title message:(NSString *)message withSureButtonTitle:(NSString *)aSureTitle withSureCancellTitle:(NSString *)aCancellTitle preferredStyle:(UIAlertControllerStyle)preferredStyle handler:(void (^ __nullable)(UIAlertAction *action))handler{
    
    
    UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
    if (aCancellTitle) {
        [alertVC addAction:[UIAlertAction actionWithTitle:aCancellTitle style:UIAlertActionStyleDefault handler:handler]];
    }
    if (aSureTitle) {
           [alertVC addAction:[UIAlertAction actionWithTitle:aSureTitle style:UIAlertActionStyleDefault handler:handler]];
    }

    NSMutableAttributedString *alertControllerMessageStr = [[NSMutableAttributedString alloc] initWithString:message];
    [alertControllerMessageStr addAttribute:NSForegroundColorAttributeName value:RGBCOLOR(102, 102, 102) range:NSMakeRange(0, alertControllerMessageStr.length)];
    [alertControllerMessageStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:15] range:NSMakeRange(0, alertControllerMessageStr.length)];
     [alertVC setValue:alertControllerMessageStr forKey:@"attributedMessage"];
    
    return(CustomalertViewController *) alertVC;


}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
